package com.ktwlrj.core.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 定金管理定时任务
 *
 * @author zhouxuanhong
 * @date 2019-09-26 12:39
 * @since JDK1.8
 */
@EnableScheduling
@Configuration
public class ScheduledTimerConfig {
    /**
     * 线程池配置
     *
     * @return TaskScheduler ${@link TaskScheduler}
     * @author zhouxuanhong
     * @date 2019-09-26 13:18
     */
    @Bean
    @Primary
    public TaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
        taskScheduler.setPoolSize(16);
        taskScheduler.setThreadNamePrefix("springboot-task");
        return taskScheduler;
    }
}
